Repository navigation
feat(amd): add a polkit-gated rebuild unit alongside the sudo rule - #11970
Conversation
Replace the NOPASSWD sudo rule with agent-rebuild-switch.service and a polkit rule that lets user start only that unit. Agents run systemctl start --no-block agent-rebuild-switch.service, so sudo can stay blocked in Desktop Commander. The unit runs the same no-argument wrapper (switch to main#amd) from / with a fixed environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Drew asked to allow both for now: restore the NOPASSWD rule for sudo agent-rebuild-switch (no arguments) next to the agent-rebuild-switch.service polkit path. Both run the same wrapper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The token in /home/user/auth now gets 401 Bad credentials from GitHub, which fails every flake fetch, public inputs included. Check it first (header on stdin, never in argv) and fetch without it when rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Before: the only passwordless rebuild path for agents on amd is
sudo agent-rebuild-switch(#11959), which needssudounblocked in Desktop Commander. The wrapper also passes the token from/home/user/authto nix, and that token now gets401 Bad credentialsfrom GitHub, so every fetch would fail.After: agents can use either path, both running the same no-argument wrapper (switch to
github:developing-today/code/main#amd):sudo agent-rebuild-switch(unchanged rule from feat(amd): passwordless agent-rebuild-switch from main #11959), orsystemctl start --no-block agent-rebuild-switch.service, allowed foruserby a polkit rule without sudo, sosudocan stay blocked in Desktop Commander.The wrapper now checks the token first and fetches without it when GitHub rejects it.
How
systemd.services.agent-rebuild-switch: oneshot, runs the wrapper as root withWorkingDirectory=/and systemd's clean environment.restartIfChanged/stopIfChangedare off so the switch it runs never stops the unit.security.polkit.extraConfig: allowsorg.freedesktop.systemd1.manage-unitsonly when the unit isagent-rebuild-switch.service, the verb isstart, and the subject isuser.api.github.com/rate_limitwith the token, the header passed on stdin so the token never appears inps. On 401 it logs that and continues without the token.journalctl -u agent-rebuild-switch -f.Checks
/home/user/authreturns 401 and no token returns 200; a dummy token sent via-H @-returns 401, so the check detects it.nixfmt --checkandstatix checkpass.Generated by Claude Code
Summary by CodeRabbit